Carbon


InitCPort

Header: Quickdraw.h Carbon status: Supported

Initializes a color graphics port.

void InitCPort (
    CGrafPtr port
);
port

A pointer to a CGrafPort structure.

DISCUSSION

Your application should not normally have to call this function. When your application creates a new graphics port using the GetNewCWindow, NewCWindow, or the NewGWorld functions, those functions call OpenCPort, which in turn calls the InitCPort function.

The InitCPort function is analogous to InitPort, except InitCPort initializes a CGrafPort structure instead of a GrafPort structure. The InitCPort function does not allocate any storage; it merely initializes all the fields in the CGrafPort and GrafVars structures to the default values.

The PixMap structure for the new color graphics port is set to be the same as the current device’s PixMap structure. This allows you to create an offscreen graphics world that is identical to the screen’s port for drawing offscreen. To use a different set of colors for offscreen drawing, create a new GDevice structure and set it as the current GDevice structure before opening the CGrafPort structure.

InitCPort does not copy the data from the current device’s CLUT to the color table for the graphics port’s PixMap structure. It simply replaces whatever is in the PixMap structure’s pmTable field with a copy of the handle to the current device’s CLUT.

If you try to initialize a GrafPort structure using InitCPort, it simply returns without doing anything.

SPECIAL CONSIDERATIONS

The InitCPort function may move or purge memory blocks in the application heap; do not call this function at interrupt time.

AVAILABILITY

Supported in Carbon. Not available in CarbonLib, but available when InterfaceLib 7.1 or later is installed. Exported by InterfaceLib 7.1 and later.


© 2000 Apple Computer, Inc. — (Last Updated 4/14/2000)